import AutoImport from 'unplugin-auto-import/vite'
import ElementPlus from 'unplugin-element-plus' // js中手动导入style/css
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
import Components from 'unplugin-vue-components/vite'

export function configAutoImportPlugin() {
  const plugin = [
    AutoImport({
      imports: ['vue', 'vue-router', '@vueuse/core'],
      resolvers: [ElementPlusResolver()],
      eslintrc: {
        enabled: true,
      },
    }),
    Components({
      dts: true,
      include: [/\.vue$/, /\.vue\?vue/, /\.vue\?v=/, /\.[jt]sx$/],
      resolvers: [ElementPlusResolver()],
    }),
    ElementPlus.vite({}),
  ]
  return plugin
}
